package com.jinandi.app.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * <角色类型>
 * @author CGC
 * @version [记录版本号, 2013-4-17]
 */
@Entity
@Table(name = "JND_AUTHORIT")
public class Authorit extends ManagedIdentityDomainObject<Authorit> {

	private static final long serialVersionUID = -4662283622554027375L;
	private String authority; // 权限英文名
	private String auName; // 权限中文名
	
	private List<AuthoritAndRes> authiritAndRes; // 角色拥有的资源
	
	@JsonIgnore
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "authorit")
	public List<AuthoritAndRes> getAuthiritAndRes() {
		return authiritAndRes;
	}

	public void setAuthiritAndRes(List<AuthoritAndRes> authiritAndRes) {
		this.authiritAndRes = authiritAndRes;
	}

	@Column(name="authority",length=100,nullable = false,unique = true)
	public String getAuthority() {
		return authority;
	}

	public void setAuthority(String authority) {
		this.authority = authority;
	}

	@Column(name="auName",length=100,nullable = false,unique = true)
	public String getAuName() {
		return auName;
	}

	public void setAuName(String auName) {
		this.auName = auName;
	}
}
